package com.dp.proxy.dynamicJDK;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: dupeng
 * @CreateTime: 2025-01-07  10:14
 * @Description: TODO
 */
public class PersonProxy implements InvocationHandler {

    private Object realObject;

    public PersonProxy(Object object) {
        this.realObject = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("前置增强");
        Object result = method.invoke(realObject, args);
        System.out.println("后置增强");
        return result;
    }
}
